
#pragma once

#include <cstdio>
#include <iostream>
#include "../utils/macro.hpp"

// TODO
// change if else to switch
void PrintWithColor(Color color,std::string s){
    if (color == Color::Red){
        printf("\033[31m");
        std::cout << s;
        printf("\033[0m");
    }
    else if (color == Color::Green){
        printf("\033[32m");
        std::cout << s;
        printf("\033[0m");
    }
    else if (color == Color::Yellow){
        printf("\033[33m");
        std::cout << s;
        printf("\033[0m");
    }
    else if (color == Color::Blue){
        printf("\033[34m");
        std::cout << s;
        printf("\033[0m");
    }
}

// TODO
// change if else to switch
void PrintWithColor(Color color,char c) {
    if (color == Color::Red) {
        printf("\033[31m");
        putchar(c);
        printf("\033[0m");
    }
    else if (color == Color::Green) {
        printf("\033[32m");
        putchar(c);
        printf("\033[0m");
    }
    else if (color == Color::Yellow) {
        printf("\033[33m");
        putchar(c);
        printf("\033[0m");
    }
    else if (color == Color::Blue) {
        printf("\033[34m");
        putchar(c);
        printf("\033[0m");
    }else {
		putchar(c);
    }
}

void PrintStd(const char* str){
	ASSERT(str!=NULL);
	printf("%s\n",str);
}

void PrintStd(std::string str){
	std::cout<<str<<std::endl;
}

void PrintHelp(){
    printf("\n帮助文档：\n");
    printf("命令                       功能说明                        参数说明\n");
    printf("\n");
    printf("Roll            掷骰子命令，行走1`6步，步数随机产生             无\n");
    printf("\n");
    printf("Sell n          轮到玩家时，可出售自己的任意房产，出售     n为房产的绝对位置\n");
    printf("                价格为投资总成本的2倍\n");
    printf("\n");
    printf("Block n         玩家可将路障放置到当前位置前后10部的任     n为前后相对距离\n");
    printf("                何位置，任一玩家经过将被拦截，一次有效     负数表示后方\n");
    printf("\n");
    printf("Robot           使用该道具将清除前方10步内任何其他道具\n");
    printf("\n");
    printf("Query           显示自家资产\n");
    printf("\n");
    printf("Help            查看命令帮助\n");
    printf("\n");
    printf("Quit            强制退出\n\n");
}

void ClearScreen(){
#ifdef _WIN32
	system("cls");
#else
	system("clear");
#endif
}
